<HTML><HEAD><TITLE>eval(+Expression, -Result)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Arithmetic</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>eval(+Expression, -Result)</H1>
Used to evaluate eval/1 terms in arithmetic expressions.
<DL>
<DT><EM>Expression</EM></DT>
<DD>An arithmetic expression.
</DD>
<DT><EM>Result</EM></DT>
<DD>A variable or a number.
</DD>
</DL>
<H2>Description</H2>
   This is one of the predicates used by the ECLiPSe compiler to expand
   arithmetic expressions. If an expression contains a subexpression that
   is not known at compile time, it must be wrapped in eval/1, e.g.
<PRE>
   X is eval(Expr)+1
</PRE>
   This will be compiled into the sequence
<PRE>
   eval(Expr,T1), +(T1,1,X)
</PRE>
   and eval/2 will interpret the expression Expr at runtime.

<H3>Modes and Determinism</H3><UL>
<LI>eval(+, -) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Expression is uninstantiated.
<DT><EM>(21) undefined arithmetic expression </EM>
<DD>An evaluation predicate in the expression is not defined.
<DT><EM>(24) number expected </EM>
<DD>Expression is not a valid arithmetic expression.
</DL>
<H2>Examples</H2>
<PRE>



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/arithmetic/is-2.html">is / 2</A>
</BODY></HTML>
